$(function () {
    var submit_btn = $('#submit-btn');
    submit_btn.on('click', function () {
        var telephone_input = $('input[name="telephone"]');
        var password_input = $('input[name="password"]');
        var remember_input = $('input[name="remember"]');
        juneajax.post({
            'url': '/signin/',
            'data': {
                'telephone': telephone_input.val(),
                'password': password_input.val(),
                'remember': remember_input.val()
            },
            'success': function (data) {
                if (data['code']==200) {
                    var referer_url = $('#referer-span').text();
                    if (referer_url){
                        window.location = referer_url
                    }else{
                        window.location = '/'
                    }
                }else{
                    var error_info = $('#error-info');
                    error_info.text("*"+data['message'])
                }
            },
            'fail': function (error) {
                var error_info = $('#error-info');
                    error_info.text("*"+data['message'])
            }
        })
    })
});